package br.com.conhecimento.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.springframework.stereotype.Component;

/**
 * Modelo de Dados de Menu.
 * @author Luis Garcia
 */
@Entity
@Table(name = "tb_menu_item")
@Component("menuItem")
public class MenuItem extends ModeloBase {

	/** Serial Version. */
	private static final long serialVersionUID = 1L;
	
	@Column(name="DESCRICAO")
	private String descricao;

	@Column(name="LINK")
	private String link;
	
	@Column(name="IMG_LINK")
	private String imgLink;
	
    @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
	@Cascade({org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.MERGE})
    @JoinColumn(name="ID_MENU", referencedColumnName="ID")
    private Menu menu;

    public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getImgLink() {
		return imgLink;
	}

	public void setImgLink(String imgLink) {
		this.imgLink = imgLink;
	}

	public Menu getMenu() {
		return menu;
	}

	public void setMenu(Menu menu) {
		this.menu = menu;
	}

	@Override
	public String toString(){
		return "[MenuItem: "+this.getId()+"]";
	}

}